package com.github.tyc.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.tyc.dao.JobLogDao;
import com.github.tyc.entity.SysJobLog;
import com.github.tyc.service.JobLogService;
import com.github.tyc.util.PageUtils;
import com.github.tyc.util.Query;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service("scheduleJobLogService")
public class JobLogServiceImpl extends ServiceImpl<JobLogDao, SysJobLog> implements JobLogService {

	@Override
	public PageUtils queryPage(Map<String, Object> params) {
		String jobId = (String)params.get("jobId");

		IPage<SysJobLog> page = this.page(
			new Query<SysJobLog>().getPage(params),
			new QueryWrapper<SysJobLog>().like(StringUtils.isNotBlank(jobId),"job_id", jobId)
		);

		return new PageUtils(page);
	}

}
